package OOP.SmallCash;

public class Recoder {
    private String [][]record = new String[0][4];
    int counter = 0;

    //录入信息
    public void recoder(String place,String money,String time,String rest) {
          //先动态扩容
            String[][] newrecord= new String[record.length+1][4];
            for (int i = 0; i < record.length; i++) {
                for (int j = 0; j < record[i].length; j++) {
                    newrecord[i][j] = record[i][j];
                }
            }
            record = newrecord;

            //录入信息
            record[counter][0]=place;
            record[counter][1]=money;
            record[counter][2]=time;
            record[counter][3]=rest;
            counter++;
    }

    //打印记账本
    public void getmessage(){
        for(int i=0;i<record.length;i++){
            for(int j=0;j<record[i].length;j++){
                System.out.print(record[i][j]+"\t");
            }  System.out.println();
        }

    }


}
